package com.lycx.businessmanager.manager;

import java.util.ArrayList;
import java.util.List;

import com.lycx.businessmanager.model.Dictionary;

public class DictionaryManager {

	private static List<Dictionary> dictionaryList = new ArrayList<Dictionary>();
	
	public static void setDictList(List<Dictionary> dictList){
		dictionaryList.clear();
		dictionaryList.addAll(dictList);
	}
	
	public static List<Dictionary> getDictList(){
		return dictionaryList;
	}
	
	public static String valueToName(String dictType,String dictValue){
		if( dictionaryList !=null && dictionaryList.size() > 0){
			for(Dictionary dict : dictionaryList){
				if(dict.getDictType().equals(dictType) && dict.getDictValue().equals(dictValue)){
					return dict.getDictName();
				}
			}
		}
		return null;
	}
}
